
EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataElement', @level2type=N'COLUMN',@level2name=N'DataType'

GO

EXEC sys.sp_dropextendedproperty @name=N'MS_Description' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataElement', @level2type=N'COLUMN',@level2name=N'DEID'

GO

ALTER TABLE [dbo].[DataElement] DROP CONSTRAINT [DF_DataElement_DataType]
GO

/****** Object:  Table [dbo].[DataElement]    Script Date: 7/13/2013 5:02:56 AM ******/
DROP TABLE [dbo].[DataElement]
GO

/****** Object:  Table [dbo].[DataElement]    Script Date: 7/13/2013 5:02:56 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[DataElement](
	[DEID] [bigint] IDENTITY(1,1) NOT NULL,
	[DECode] [nchar](10) NOT NULL,
	[DataType] [nchar](10) NOT NULL,
	[DataDesc] [nchar](60) NULL,
 CONSTRAINT [PK_DataElement] PRIMARY KEY CLUSTERED 
(
	[DEID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [UK_DataElement] UNIQUE NONCLUSTERED 
(
	[DECode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[DataElement] ADD  CONSTRAINT [DF_DataElement_DataType]  DEFAULT (N'char') FOR [DataType]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Data Element ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataElement', @level2type=N'COLUMN',@level2name=N'DEID'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'char,int,float,bool' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'DataElement', @level2type=N'COLUMN',@level2name=N'DataType'
GO

